package cn.javabb.bootdemo.job;

import cn.javabb.bootdemo.service.StDataSynService;
import cn.javabb.bootdemo.service.WaterSynService;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author QINB imqinbao@163.com
 * @CreateDate 2019/1/10/010 12:13
 * @Since V1.0
 */
@Component
public class Jobs {
    public final static long FIVE_MINUTE = 5*60*1000;
    @Autowired
    StDataSynService stDataSynService;
    @Autowired
    WaterSynService waterSynService;
    /*@Scheduled(fixedDelay=ONE_MINUTE)
    public void fixedDelayJob(){
        System.out.println(DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")+" >>fixedDelay执行....");
    }
*/
    @Scheduled(fixedRate=FIVE_MINUTE)
    public void fixedRateJob(){
        stDataSynService.pptnSyn();
        stDataSynService.riverSyn();
        stDataSynService.rsvrSyn();
        stDataSynService.rsvrOracleSyn();
    }

    //每分钟的第2秒执行
    @Scheduled(fixedRate=FIVE_MINUTE)
    public void waterSyn(){
        waterSynService.MpQRSyn(1);
        waterSynService.MpZRSyn(1);
    }

}
